package com.jinzhi.jzweb.controller.moduleConfig;


import java.util.*;

import com.jinzhi.jzweb.domain.moduleConfig.SignGradeDO;
import com.jinzhi.jzweb.service.moduleConfig.SignGradeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.baomidou.mybatisplus.plugins.Page;
import com.jinzhi.common.annotation.Log;
import com.jinzhi.common.base.BaseController;
import com.jinzhi.common.utils.Result;

/**
 * 
 * <pre>
 * 
 * </pre>
 * <small> 2024-03-05 16:18:09 | lance</small>
 */
@Controller
@RequestMapping("/jzweb/signGrade")
public class SignGradeController extends BaseController {
	@Autowired
	private SignGradeService signGradeService;

	/**
	 * 录分页面
	 * @return
	 */
	@GetMapping("/entryA")
	String SignGrade(){
	    return "jzweb/entry/entryA";
	}
	
	@ResponseBody
	@GetMapping("/entryAList")
	public Result<Page<SignGradeDO>> entryAList(SignGradeDO signGradeDTO){

		return Result.ok(signGradeService.entryAList(signGradeDTO));
	}

	//录分新增页面
	@GetMapping("/entryAAdd")
	String add(){
	    return "jzweb/entryA/add";
	}

	@GetMapping("/editEntryA/{id}")
	String edit(@PathVariable("id") Long id,Model model){
		SignGradeDO signGrade = signGradeService.selectById(id);
		model.addAttribute("signGrade", signGrade);
	    return "jzweb/entryA/edit";
	}

	/**
	 * 通过id编辑或者新增录分
	 * @param signGradeDTO
	 * @return
	 */
	@ResponseBody
	@PostMapping("/updateEntryA")
	public Result<?> insertUpdateById(@RequestBody SignGradeDO signGradeDTO){
		signGradeService.insertUpdateById(signGradeDTO);
		return Result.ok();
	}
	
}
